﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Models
{
    public class Pagination
    {
        /// <summary>
        /// 每页行数
        /// </summary>
        public int pageSize { get; set; }
        /// <summary>
        /// 当前页
        /// </summary>
        public int pageInt { get; set; }

        /// <summary>
        // 排序字段,可以有多个，用逗号隔开，按照从前到后的顺序进行排序
        /// </summary>
        public string sidx { get; set; }
        /// <summary>
        // 排序方式
        /// </summary>
        public string sord { get; set; }
        /// <summary>
        /// 总记录数
        /// </summary>
        public int records { get; set; }
        /// <summary>
        /// 总页数
        /// </summary>
        public int total
        {
            get
            {
                if (records > 0)
                {
                    return records % this.pageSize == 0 ? records / this.pageSize : records / this.pageSize + 1;
                }
                else
                {
                    return 0;
                }
            }
        }
    }
}